import { defineMock } from 'vite-plugin-mock-dev-server'

export default defineMock([
  {
    url: '/api/article/:id',
    body: (req) => {
      const articleId = req.params.id
      return {
        code: 0,
        msg: 'success',
        data: {
          id: articleId,
          title: 'Are you back on the beers this weekend?',
          author: 'Paul Ringsell',
          publishDate: '17 January, 2025',
          readTime: '5 min read',
          viewCount: 1250,
          likeCount: 42,
          favoriteCount: 18,
          mobileImage: 'https://thefoodbrandguys.com/uploads/images/_1152xAUTO_crop_center-center_none/blog-brooklyn-beer-label.jpg',
          desktopImage: 'https://thefoodbrandguys.com/uploads/images/_1920xAUTO_crop_center-center_none/blog-brooklyn-beer-label.jpg',
          imageAlt: 'Brooklyn Beer Label',
          tags: ['问卷调查', '模板', '客户反馈', '市场研究', '数据收集'],
          content: `
            <p>As we move into the second half or <strong>#DryJanuary</strong>, some of you might be having a wobble or relying on willpower alone.</p>
            <p>Alcohol in society is increasingly drawing parallels to what happened with tobacco. The alcoholic drinks market is more nuanced and depends on cultural, regulatory, and societal factors. But as many of us become more mindful about our consumption, up to 38% of drinkers are now reaching for low or no-alcohol drinks regularly.</p>
            <p>Many people are still sceptical about low or no-alcohol choices, perhaps seeing those options as a 'substitute' or a pale imitation of the real thing. But things have changed since Barbican and Kaliber. Big breweries have been investing in the category, brands are catching on, and drinkers are beginning to notice.</p>
            <p>This month marks the fifth year since I decided to ditch the booze. Since then the range and quality of NoLo products has increased dramatically. Over the last few years I've tried tonnes of new brands. I still enjoy a good beer and I've seen a huge improvement in the quality of new products coming to market.</p>
            <p>If you're looking for alternative options to try, here are some of my current faves:</p>
            <p><a href="https://www.brooklynbrewery.world/special-effects-hoppy-lager/" target="_blank"><strong>Brooklyn Brewery</strong></a> — Special Effects (hoppy lager)</p>
            <p><a href="https://www.kehrwieder.shop/ipa-alkoholfrei" target="_blank"><strong>Kehrwieder</strong></a> — üNN IPA (awesome IPA)</p>
            <p><a href="https://www.bigdropbrew.com/drinks/alcohol-free-pale-ale/" target="_blank"><strong>Big Drop Brewing Co</strong></a> — Pine Trail (hoppy pale ale)</p>
            <p><a href="https://beavertownbrewery.co.uk/products/lazer-crush" target="_blank"><strong>Beavertown Brewery</strong></a> — Lazer Crush (fruity IPA)</p>
            <p><a href="https://daysbrewing.com/products/alcohol-free-pale-ale-cans" target="_blank"><strong>Days Brewing</strong></a> — Pale Ale (tropical 0% pale ale)</p>
            <p><a href="https://luckysaint.co/products/lucky-saint-lager-bottles" target="_blank"><strong>Lucky Saint</strong></a> — Lager (Bavarian pilsner)</p>
            <p><a href="https://drydrinker.com" target="_blank"><strong>DRY DRINKER</strong></a> — discover more options</p>
            <p><strong>#HappyFriday</strong> 🍻</p>
            <p><strong>#DryJanuaryChallenge</strong></p>
            <p>Get in touch for more beer recommendations.</p>
          `,
          enableComments: true,
          comments: [
            {
              id: 1,
              author: '啤酒爱好者',
              avatar: 'https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=150&h=150&fit=crop&crop=face',
              content: '这篇文章太及时了，正好在寻找无酒精啤酒的推荐！Brooklyn的特效系列确实不错。',
              time: '2小时前',
              likes: 12
            },
            {
              id: 2,
              author: '健康生活',
              avatar: 'https://images.unsplash.com/photo-1570295999919-56ceb5ecca61?w=150&h=150&fit=crop&crop=face',
              content: '尝试过Lucky Saint，口感真的很接近普通啤酒，推荐给正在戒酒的朋友们。',
              time: '5小时前',
              likes: 8
            }
          ]
        }
      }
    },
    enabled: true,
  },
  {
    url: '/api/article/:id/comments',
    method: 'POST',
    body: (req) => {
      return {
        code: 0,
        msg: '评论发布成功',
        data: {
          id: Date.now(),
          author: '当前用户',
          avatar: 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=150&h=150&fit=crop&crop=face',
          content: req.body.content,
          time: '刚刚',
          likes: 0
        }
      }
    },
    enabled: true,
  },
  {
    url: '/api/article/:id/like',
    method: 'POST',
    body: {
      code: 0,
      msg: '点赞成功',
      data: {
        likeCount: 43
      }
    },
    enabled: true,
  },
  {
    url: '/api/article/:id/favorite',
    method: 'POST',
    body: {
      code: 0,
      msg: '收藏成功',
      data: {
        favoriteCount: 19
      }
    },
    enabled: true,
  }
])